{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导包\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "import seaborn as sns\n",
    "import jieba\n",
    "\n",
    "import collections\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def read_file_word2dict(filename):\n",
    "    with open(filename, 'r') as f:\n",
    "        dictionary = dict()\n",
    "        for line in f.readlines():\n",
    "            line = line.strip().split(' ')\n",
    "            for word in line:\n",
    "                if word not in dictionary:\n",
    "                    dictionary[word] = len(dictionary) + 1\n",
    "        return dictionary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAEKCAYAAADaa8itAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvFvnyVgAAFaRJREFUeJzt3X/wXXV95/HnSwKVVSlQvrA0gY27TVVqq0IKcdmxW3FCsFaYjuziVkktO+k46OBsp13cnSmt1lk7u60Vf+0yEk1ct8hqXaKLxixCHStCgiAI6JKlVr4TloQGEOuWDvS9f9xPmmu4Sb4kn5vz/ZLnY+bOPed9Pud83+f+kVfOj3tuqgpJknp4ztANSJKePQwVSVI3hookqRtDRZLUjaEiSerGUJEkdWOoSJK6MVQkSd0YKpKkbhYN3cChdsIJJ9TSpUuHbkOSFozbbrvt4aqamcvYwy5Uli5dypYtW4ZuQ5IWjCR/Odexnv6SJHVjqEiSujFUJEndGCqSpG4MFUlSN1MNlSTHJvl0km8nuTfJK5Mcn2RTkvva+3FtbJJcmWRrkjuTnD62ndVt/H1JVo/Vz0hyV1vnyiSZ5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cNRBbG9RVT3ZrUFpSjxSkabjZODhqnoCoKoerqptSX4+ydfab6fcmuQF7fdUPtZ+N+P2JL8IkOTXkvz3JJ8DvtRqv5Vkczv6Oax/d0Xzk0cq0nR8CfidJP8b+F/Apxg9TeFTwL+sqs1JjgH+H3AZQFX9bJIXM3oq7U+37bwS+Lmq2plkJbCM0fOfAmxI8qr2kwrSvOCRijQF7fdRzgDWADsYhclvAA9W1eY25vvtlNY/Az7Rat8G/hLYFSqbqmrXb/CsbK/bgW8AL2YUMtK84ZGKNCVV9RSjJw7flOQu4FIm//hW9rGZv95j3H+oqv/SrUmpM49UpClI8qIk40cRL2f065Y/meTn25gXJFkEfAX41Vb7aeBU4DsTNrsR+PX2GzQkWZzkxCnuhvSMeaQiTcfzgQ+0R9o/CWxldCrsY61+NKPrKa8BPgz853Y08yTwa+2OsR/ZYFV9KclLgJvbsh8Ab2L0a5HSvOBTiiVJ3Xj6S5LUjaEiSerGUJEkdWOoSJK6MVQkSd0YKpKkbgwVSVI3hookqZv/D7JtNDRwVuv2AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[5 4 3 2 1]\n",
      "(100000, 3) (30000, 2)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>Discuss</th>\n",
       "      <th>Score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>201e8bf2-77a2-3a98-9fcf-4ce03914e712</td>\n",
       "      <td>好大的一个游乐公园，已经去了2次，但感觉还没有玩够似的！会有第三，第四次的</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>f4d51947-eac4-3005-9d3c-2f32d6068a2d</td>\n",
       "      <td>新中国成立也是在这举行，对我们中国人来说有些重要及深刻的意义！</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>74aa7ae4-03a4-394c-bee0-5702d3a3082a</td>\n",
       "      <td>庐山瀑布非常有名，也有非常多个瀑布，只是最好看的非三叠泉莫属，推荐一去</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>099661c2-4360-3c49-a2fe-8c783764f7db</td>\n",
       "      <td>个人觉得颐和园是北京最值的一起的地方，不过相比下门票也是最贵的，比起故宫的雄伟与气势磅礴，颐...</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>97ca672d-e558-3542-ba7b-ee719bba1bab</td>\n",
       "      <td>迪斯尼一日游</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     Id  \\\n",
       "0  201e8bf2-77a2-3a98-9fcf-4ce03914e712   \n",
       "1  f4d51947-eac4-3005-9d3c-2f32d6068a2d   \n",
       "2  74aa7ae4-03a4-394c-bee0-5702d3a3082a   \n",
       "3  099661c2-4360-3c49-a2fe-8c783764f7db   \n",
       "4  97ca672d-e558-3542-ba7b-ee719bba1bab   \n",
       "\n",
       "                                             Discuss  Score  \n",
       "0              好大的一个游乐公园，已经去了2次，但感觉还没有玩够似的！会有第三，第四次的      5  \n",
       "1                    新中国成立也是在这举行，对我们中国人来说有些重要及深刻的意义！      4  \n",
       "2                庐山瀑布非常有名，也有非常多个瀑布，只是最好看的非三叠泉莫属，推荐一去      4  \n",
       "3  个人觉得颐和园是北京最值的一起的地方，不过相比下门票也是最贵的，比起故宫的雄伟与气势磅礴，颐...      5  \n",
       "4                                             迪斯尼一日游      5  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 加载数据集\n",
    "model_path = '../input/'\n",
    "\n",
    "trainFile = model_path + 'train_first.csv'\n",
    "testFile = model_path + 'predict_first.csv'\n",
    "\n",
    "train = pd.read_csv(trainFile)\n",
    "test = pd.read_csv(testFile)\n",
    "\n",
    "\n",
    "sns.countplot(x = 'Score',data = train)\n",
    "plt.show()\n",
    "\n",
    "print(train['Score'].unique())  # 采取多分类？\n",
    "print(train.shape, test.shape)\n",
    "\n",
    "\n",
    "test['Score'] = -1\n",
    "data = pd.concat([train, test])\n",
    "\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "c:\\users\\demonsong\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\IPython\\core\\interactiveshell.py:2728: DtypeWarning: Columns (12,49) have mixed types. Specify dtype option on import or set low_memory=False.\n",
      "  interactivity=interactivity, compiler=compiler, result=result)\n"
     ]
    }
   ],
   "source": [
    "data_best = pd.read_csv(model_path + '/best feature/data.csv')\n",
    "data_best.head()\n",
    "del data_best['Score']\n",
    "\n",
    "data = pd.merge(data, data_best, on = 'Id', how = 'left')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# hancks 分词\n",
    "train_word = pd.read_csv(model_path + 'train_word.csv')\n",
    "test_word = pd.read_csv(model_path + 'predict_word.csv')\n",
    "data_word = pd.concat([train_word, test_word])\n",
    "\n",
    "# 群里siginicant word\n",
    "significant_dictionary =  read_file_word2dict(model_path + 'significance.txt')\n",
    "def contain(word, key):\n",
    "    return 1 if key in word else 0\n",
    "\n",
    "for _, key in enumerate(significant_dictionary.keys()):\n",
    "    data_word['significant_key_{}'.format(_)] = data_word['words'].apply(lambda x : contain(x, key))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
